﻿using System.Collections.Generic;
using HtmlAgilityPack;

namespace MvcWebScraper.Core.Parsers
{
	public abstract class MobileCIDRScraper<T> : IScraperInvoker<T>
		where T : class, IList<string>, new()
	{
		public T Invoke(string html)
		{
			var cidr = new T();

			if (!string.IsNullOrEmpty(html))
			{
				var doc = new HtmlDocument();
				doc.LoadHtml(html);
				return Parser(doc);
			}

			return cidr;
		}

		protected abstract T Parser(HtmlDocument document);
	}
}
